package com.czh.springboot04.service;

import com.czh.springboot04.entity.Course;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface CourseService {
    public PageInfo<Course> findAll(int pageNum, int pageSize);
    public int addCourse(Course course);
    public int updateCourse(Course course);
    public int deleteCourse(int id);
    //根据id查询
    public PageInfo<Course> findCourseById(int id, int pageNum, int pageSize);
    //根据课程id查询课程
    public Course findCourseByCourseId(int id);

    //根据课程名称模糊查询
    PageInfo<Course> selectCourseByName(String courseName, int pageNum, int pageSize);
    //根据价格升序查询
    PageInfo<Course> selectCourseByPriceAsc(int pageNum, int pageSize);
    //根据价格降序查询
    PageInfo<Course> selectCourseByPriceDesc(int pageNum, int pageSize);
    //根据价格区间查询
    PageInfo<Course> selectCourseByPrice(double min,double max,int pageNum, int pageSize);
    //根据收藏量降序查询
    PageInfo<Course> selectCourseByCollection(int pageNum, int pageSize);
    //根据课程类型查询
    PageInfo<Course> selectCourseByType(int pageNum, int pageSize,int typeId);
    //根据课程类型并根据收藏量查询降序
    PageInfo<Course> selectCourseByTypeAndCollection(int pageNum, int pageSize,int typeId);
    //根据课程类型并根据价格查询升序查询
    PageInfo<Course> selectCourseByTypeAndPriceAsc(int pageNum, int pageSize,int typeId);
    //根据课程类型并根据价格查询降序查询
    PageInfo<Course> selectCourseByTypeAndPriceDesc(int pageNum, int pageSize,int typeId);
    //根据课程类型并根据价格区间查询
    PageInfo<Course> selectCourseByTypeAndPrice(int pageNum, int pageSize,@Param("min") double min, @Param("max") double max, @Param("typeId") int typeId);
}
